<?php

use Illuminate\Http\Request;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::namespace('App')->group(function () {
    Route::post('login', 'UserController@login');
    Route::get('settings', 'SettingController@all');

    Route::post('address/add','UserController@addAddress');

    Route::prefix('product/merchant')->group(function (){
        Route::post('add','MerchantController@addProduct');
        Route::post('list','MerchantController@merchantProductList');
        Route::post('detail','MerchantController@merchantProductDetail');
        Route::post('edit','MerchantController@editMerchantProduct');
        Route::post('delete','MerchantController@deleteMerchantProduct');
        Route::post('image/delete','MerchantController@deleteMerchantProductImage');
        Route::post('image/upload','MerchantController@uploadProductImage');
        Route::post('shelves','MerchantController@putOnShelves');
        Route::post('order/list','MerchantController@getOrderList');
        Route::post('order/count','MerchantController@getOrderAmount');
        Route::post('send','MerchantController@sendProducts');
    });


    Route::prefix('product')->group(function (){
        Route::get('getCate','ProductController@getCategories');
        Route::get('list','ProductController@productList');
        Route::get('categories/{id}','ProductController@getCategoryProducts');
        Route::get('feature','ProductController@getFeatureProducts');
        Route::get('search','ProductController@searchProducts');
        Route::post('detail/{id}','ProductController@productDetail');
        Route::post('details','ProductController@productDetailList');
        Route::post('buyRecord','ProductController@buyRecord');

    });
    Route::prefix('order')->group(function (){
        Route::post('place',"OrderController@placeOrder");
        Route::post('rePlace',"OrderController@rePlaceOrder");
        Route::post('notify',"OrderController@notify");
        Route::post('list',"OrderController@getOrders");
        Route::post('delete',"OrderController@deleteOrder");
        Route::post('count',"OrderController@getOrderAmount");
    });
    Route::prefix('cart')->group(function (){
        Route::get('all',"CartController@all");
        Route::post('create',"CartController@create");
        Route::post('update',"CartController@update");
        Route::post('destroy',"CartController@destroy");
    });
    Route::prefix('activity')->group(function (){
        Route::post('commission',"CommissionController@getCommissions");
        Route::post('test',"CommissionController@test");
    });






    Route::post('user/edit','UserController@updateUser');



    Route::post('order/list','OrderController@getOrders');


});


